package com.xie.springCloud.MyRule;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import com.netflix.loadbalancer.RoundRobinRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyRuleConfig {
    /**
     * RandomRule 随机
     * AvailabilityFilteringRule 可用性过滤 就是去掉有问题的服务
     * RetryRule 重试
     * WeightedResponseTimeRule 权重
     * RoundRobinRule 轮询
     * @return
     */
    //随机
    @Bean
    public IRule myRandomRule(){
        //采用自动义的算法轮询
        //return new MyRandomRule();
        return new RandomRule();

    }


}
